package com.wm.yigongfang.common.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

/**
 * @author zp
 * @version 1.0
 * @date 2021/5/10 0:44
 */
@Data
public class PageRequest {

    /**
     * 当前页
     */
    protected Integer page;

    /**
     * 页大小
     */
    protected Integer pageSize;

    public IPage toPage() {
        if (this.page == null || this.page == 0) {
            page = 1;
        }
        if (this.pageSize == null || this.pageSize == 0) {
            pageSize = 20;
        }
        return new Page(page, pageSize);
    }
}


